package com.fqy.thread.ticket01;

/**
 * User: fqy
 * Date: 2021/8/31
 * Time: 10:04
 * Describe:
 */
public class Ticket {

    private Integer ticketBalance=50;//余票

    public synchronized String saleTicket(){
        if (ticketBalance>0){
            return Thread.currentThread().getName()+"\t"+"卖出第: "+(ticketBalance--)+"\t 还剩下: "+ticketBalance;
        }
        return "没票了";
    }
}
